/**   
 * 项目名：五位一体化工安全信息平台
 * 日期：    2020-01-10 17:30:23  
 * Copyright (c) 2015- joysuch-版权所有     
 */

package com.joysuch.wwyt.risk.entity;

import com.joysuch.wwyt.core.support.AutoSetCommonFieldListener;
import org.apache.commons.lang3.builder.EqualsBuilder;
import org.apache.commons.lang3.builder.HashCodeBuilder;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import org.hibernate.annotations.Proxy;
import org.hibernate.annotations.SQLDelete;
import org.hibernate.annotations.SQLDeleteAll;
import org.hibernate.annotations.Where;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;

import javax.persistence.*;

import static javax.persistence.GenerationType.IDENTITY;

@EntityListeners({ AuditingEntityListener.class, AutoSetCommonFieldListener.class })
@Entity
@Table(name = "wwyt_risk_evaluation_repo")
@SQLDelete(sql = "update wwyt_risk_evaluation_repo set DELETE_FLAG = '1' where id= ?")
@SQLDeleteAll(sql = "update wwyt_risk_evaluation_repo set DELETE_FLAG = '1' where id= ?")
@Where(clause = "DELETE_FLAG = '0'")
@Proxy(lazy = false)
public class RiskEvaluationRepo implements java.io.Serializable {

    // columns START
    // ID
    private Long id;
    // 风险分区ID
    private Long riskDistrictId;
    // 类型(JHA/SCL等)
    private String type;
    // 评估方法
    private String method;
    // 评估ID
    private Long evaluationId;
    // 状态
    private Integer state;
    // 评估级别
    private Integer riskLevel;
    // 有效起始时间
    private java.util.Date effectiveTimeBegin;
    // 有效截止时间
    private java.util.Date effectiveTimeEnd;
    // 作业证ID
    private Long workSafetyCertId;
    // 附加信息（扩展用）
    private String extraInfo;
    // 创建人
    private Long createBy;
    // 创建时间
    private java.util.Date createTime;
    // 更新人
    private Long updateBy;
    // 更新时间
    private java.util.Date updateTime;
    // 删除标记
    private String deleteFlag;
    // 组织机构代码
    private String orgCode;
    // 租户
    private Long tenentId;
    // columns END
    private String code;

    private RiskPoint riskPoint;
    // 是否模板
    private Integer isTemplate;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "RISK_POINT_ID")
    public RiskPoint getRiskPoint() {
        return riskPoint;
    }

    public void setRiskPoint(RiskPoint riskPoint) {
        this.riskPoint = riskPoint;
    }

    public void setId(Long value) {
        this.id = value;
    }

    @Id
    @GeneratedValue(strategy = IDENTITY)
    @Column(name = "Id", unique = true, nullable = false)
    public Long getId() {
        return this.id;
    }

    public String getCode() {
        return code;
    }

    @Column(name = "CODE", length = 15)
    public void setCode(String code) {
        this.code = code;
    }

    @Column(name = "RISK_DISTRICT_ID")
    public Long getRiskDistrictId() {
        return this.riskDistrictId;
    }

    public void setRiskDistrictId(Long value) {
        this.riskDistrictId = value;
    }

    @Column(name = "TYPE", length = 10)
    public String getType() {
        return this.type;
    }

    public void setType(String value) {
        this.type = value;
    }

    @Column(name = "METHOD", length = 10)
    public String getMethod() {
        return this.method;
    }

    public void setMethod(String value) {
        this.method = value;
    }

    @Column(name = "EVALUATION_ID")
    public Long getEvaluationId() {
        return this.evaluationId;
    }

    public void setEvaluationId(Long value) {
        this.evaluationId = value;
    }

    @Column(name = "STATE")
    public Integer getState() {
        return this.state;
    }

    public void setState(Integer value) {
        this.state = value;
    }

    @Column(name = "RISK_LEVEL")
    public Integer getRiskLevel() {
        return this.riskLevel;
    }

    public void setRiskLevel(Integer value) {
        this.riskLevel = value;
    }

    @Column(name = "EFFECTIVE_TIME_BEGIN")
    public java.util.Date getEffectiveTimeBegin() {
        return this.effectiveTimeBegin;
    }

    public void setEffectiveTimeBegin(java.util.Date value) {
        this.effectiveTimeBegin = value;
    }

    @Column(name = "EFFECTIVE_TIME_END")
    public java.util.Date getEffectiveTimeEnd() {
        return this.effectiveTimeEnd;
    }

    public void setEffectiveTimeEnd(java.util.Date value) {
        this.effectiveTimeEnd = value;
    }

    @Column(name = "WORK_SAFETY_CERT_ID")
    public Long getWorkSafetyCertId() {
        return this.workSafetyCertId;
    }

    public void setWorkSafetyCertId(Long value) {
        this.workSafetyCertId = value;
    }

    @Column(name = "EXTRA_INFO", length = 100)
    public String getExtraInfo() {
        return this.extraInfo;
    }

    public void setExtraInfo(String value) {
        this.extraInfo = value;
    }

    @org.springframework.data.annotation.CreatedBy
    @Column(name = "CREATE_BY")
    public Long getCreateBy() {
        return this.createBy;
    }

    public void setCreateBy(Long value) {
        this.createBy = value;
    }

    @org.springframework.data.annotation.CreatedDate
    @Column(name = "CREATE_TIME")
    public java.util.Date getCreateTime() {
        return this.createTime;
    }

    public void setCreateTime(java.util.Date value) {
        this.createTime = value;
    }

    @org.springframework.data.annotation.LastModifiedBy
    @Column(name = "UPDATE_BY")
    public Long getUpdateBy() {
        return this.updateBy;
    }

    public void setUpdateBy(Long value) {
        this.updateBy = value;
    }

    @org.springframework.data.annotation.LastModifiedDate
    @Column(name = "UPDATE_TIME")
    public java.util.Date getUpdateTime() {
        return this.updateTime;
    }

    public void setUpdateTime(java.util.Date value) {
        this.updateTime = value;
    }

    @Column(name = "DELETE_FLAG", length = 2)
    public String getDeleteFlag() {
        return this.deleteFlag;
    }

    public void setDeleteFlag(String value) {
        this.deleteFlag = value;
    }

    @Column(name = "ORG_CODE", length = 100)
    public String getOrgCode() {
        return this.orgCode;
    }

    public void setOrgCode(String value) {
        this.orgCode = value;
    }

    @Column(name = "TENENT_ID")
    public Long getTenentId() {
        return this.tenentId;
    }

    public void setTenentId(Long value) {
        this.tenentId = value;
    }

    @Column(name = "IS_TEMPLATE")
    public Integer getIsTemplate() {
        return isTemplate;
    }

    public void setIsTemplate(Integer isTemplate) {
        this.isTemplate = isTemplate;
    }

    public String toString() {
        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE).append("id", getId())
                .append("riskDistrictId", getRiskDistrictId()).append("type", getType()).append("method", getMethod())
                .append("evaluationId", getEvaluationId()).append("state", getState())
                .append("riskLevel", getRiskLevel()).append("effectiveTimeBegin", getEffectiveTimeBegin())
                .append("effectiveTimeEnd", getEffectiveTimeEnd()).append("workSafetyCertId", getWorkSafetyCertId())
                .append("extraInfo", getExtraInfo()).append("createBy", getCreateBy())
                .append("createTime", getCreateTime()).append("updateBy", getUpdateBy())
                .append("updateTime", getUpdateTime()).append("deleteFlag", getDeleteFlag())
                .append("orgCode", getOrgCode()).append("tenentId", getTenentId()).toString();
    }

    public int hashCode() {
        return new HashCodeBuilder().append(getId()).toHashCode();
    }

    public boolean equals(Object obj) {
        if (obj instanceof RiskEvaluationRepo == false)
            return false;
        if (this == obj)
            return true;
        RiskEvaluationRepo other = (RiskEvaluationRepo) obj;
        return new EqualsBuilder().append(getId(), other.getId()).isEquals();
    }
}
